package com.itheima.可变参数.实例;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Set;

public class Demo1 {
    public static void main(String[] args) {
        int[] arr={1,2,3,4,5,6,7,8,9,0,12,11,13,14,32,31,33,34,35};
        int kbcs = kbcs(arr);
        System.out.println(kbcs);
        ArrayList<String> list=new ArrayList<>();
        String[] arr1={};
        Collections.addAll(list,arr1);
    }

    public static int kbcs(int ... arr){
        int sum=0;
        for (int i = arr.length - 1; i >= 0; i--) {
            sum=sum+arr[i];
        }
        return sum;
    }
    public static void add(ArrayList<String> list,String ...s){
        for (String s1 : s) {
            list.add(s1);
        }
    }
}
